# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-wallpapers-plasma
pkgver=5.18.5
pkgrel=1
pkgdesc='Additional Deepin desktop wallpapers from Plasma'
arch=('any')
license=('GPL')
url="https://www.kde.org/workspaces/plasmadesktop/"
depends=('plasma-workspace-wallpapers')
makedepends=('deepin-api' 'breeze')
optdepends=('breeze: for default wallpaper in breeze theme')

package() {
  install -dm755 "$pkgdir"/usr/share/wallpapers/deepin

  for _item in /usr/share/wallpapers/*; do
    [[ ! -d $_item/contents/images ]] && continue
    _source=$(du -a $_item/contents/images/* | sort -n | tail -n 1 | cut -f 2)
    _extension=${_source##*.}
    _target=/usr/share/wallpapers/deepin/${_item##*/}.$_extension
    _md5name=$(echo -n $_target | md5sum)
    _md5name=${_md5name%  *}.$_extension

    ln -s $_source "$pkgdir"/$_target
    /usr/lib/deepin-api/image-blur --sigma 30 $_source "$pkgdir"/var/cache/image-blur/$_md5name
  done
}

